﻿namespace WMS6.Services
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.ServiceModel;
    using System.ServiceModel.Activation;
    using WMS6.BLL;
    using WMS6.Common;
    using WMS6.DataEntity;
    using WMS6.QueryEntity;

    [ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall), AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
    public class CrossdockService : ICrossdockService
    {
        public string DeleteApportionRuleInfo(List<string> OwnerIDs, List<string> CustomerIDs, List<string> SeqNos, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                ApportionRuleBLL apportionRuleBll = new ApportionRuleBLL(pubParasInfo);
                return apportionRuleBll.Delete(OwnerIDs, CustomerIDs, SeqNos);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string DeleteLaneInfo(List<string> laneIDs, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                LaneBLL laneBll = new LaneBLL(pubParasInfo);
                return laneBll.Delete(laneIDs);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string DeleteOppOrderRuleDetailInfo(List<string> opporderRuleIDs, List<string> lineIDs, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                OppOrderRuleDetailBLL OppOrderRuleDetailBll = new OppOrderRuleDetailBLL(pubParasInfo);
                return OppOrderRuleDetailBll.DeleteDetail(opporderRuleIDs, lineIDs);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string DeleteOppOrderRuleInfo(List<string> oppOrderRuleIDs, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                OppOrderRuleBLL oppOrderRuleBll = new OppOrderRuleBLL(pubParasInfo);
                return oppOrderRuleBll.Delete(oppOrderRuleIDs);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string DeleteXordersInfo(List<string> xOrderID, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                XordersBLL xordersBLL = new XordersBLL(pubParasInfo);
                return xordersBLL.DeleteXorders(xOrderID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public DataSet GetAllApportionRuleInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                ApportionRuleBLL apportionRuleBll = new ApportionRuleBLL(pubParasInfo);
                return apportionRuleBll.GetAllInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public DataSet GetAllLaneInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                LaneBLL laneBll = new LaneBLL(pubParasInfo);
                return laneBll.GetAllInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public DataSet GetAllOpporderRuleDetail(PubParasInfo pubParasInfo)
        {
            try
            {
                OppOrderRuleDetailBLL OppOrderRuleDetailBll = new OppOrderRuleDetailBLL(pubParasInfo);
                return OppOrderRuleDetailBll.GetAllDetailInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public DataSet GetAllOppOrderRuleInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                OppOrderRuleBLL oppOrderRuleBll = new OppOrderRuleBLL(pubParasInfo);
                return oppOrderRuleBll.GetAllInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public ApportionRuleInfo GetApportionRuleInfoByID(string OwnerID, string CustomerID, string SeqNo, PubParasInfo pubParasInfo)
        {
            try
            {
                ApportionRuleBLL apportionRuleBll = new ApportionRuleBLL(pubParasInfo);
                return apportionRuleBll.GetInfoByID(OwnerID, CustomerID, SeqNo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public DataSet GetApportionRuleInfoByQueryEntity(ApportionRuleQueryEntity apportionRuleQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                ApportionRuleBLL apportionRuleBll = new ApportionRuleBLL(pubParasInfo);
                return apportionRuleBll.GetInfoByQueryEntity(apportionRuleQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public List<ApportionRuleInfo> GetApportionRuleListByID(string OwnerID, PubParasInfo pubParasInfo)
        {
            try
            {
                ApportionRuleBLL apportionRuleBll = new ApportionRuleBLL(pubParasInfo);
                return apportionRuleBll.GetInfoListByID(OwnerID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public LaneInfo GetLaneInfoByID(string laneID, PubParasInfo pubParasInfo)
        {
            try
            {
                LaneBLL laneBll = new LaneBLL(pubParasInfo);
                return laneBll.GetInfoByID(laneID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public DataSet GetLaneInfoByQueryEntity(LaneQueryEntity laneQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                LaneBLL laneBll = new LaneBLL(pubParasInfo);
                return laneBll.GetInfoByQueryEntity(laneQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public DataSet GetOppOrderRuleDetailByQueryEntity(OppOrderRuleDetailQueryEntity oppOrderRuleDetailQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                OppOrderRuleDetailBLL OppOrderRuleDetailBll = new OppOrderRuleDetailBLL(pubParasInfo);
                return OppOrderRuleDetailBll.GetDetaiInfolByQueryEntity(oppOrderRuleDetailQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public OppOrderRuleDetailInfo GetOppOrderRuleDetailInfoByID(string opporderRuleID, string lineID, PubParasInfo pubParasInfo)
        {
            try
            {
                OppOrderRuleDetailBLL OppOrderRuleDetailBll = new OppOrderRuleDetailBLL(pubParasInfo);
                return OppOrderRuleDetailBll.GetDetailInfoByID(opporderRuleID, lineID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public List<OppOrderRuleDetailInfo> GetOpporderRuleDetailListByID(string opporderRuleID, PubParasInfo pubParasInfo)
        {
            try
            {
                OppOrderRuleDetailBLL OppOrderRuleDetailBll = new OppOrderRuleDetailBLL(pubParasInfo);
                return OppOrderRuleDetailBll.GetDetailInfoListByID(opporderRuleID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public OppOrderRuleInfo GetOppOrderRuleIDByID(string OppOrderRuleID, PubParasInfo pubParasInfo)
        {
            try
            {
                OppOrderRuleBLL oppOrderRuleBll = new OppOrderRuleBLL(pubParasInfo);
                return oppOrderRuleBll.GetInfoByID(OppOrderRuleID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public DataSet GetOppOrderRuleInfoByQueryEntity(OppOrderRuleQueryEntity oppOrderRuleQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                OppOrderRuleBLL oppOrderRuleBll = new OppOrderRuleBLL(pubParasInfo);
                return oppOrderRuleBll.GetInfoByQueryEntity(oppOrderRuleQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public XorderDetailInfo GetXorderDetailInfoByID(string xOrderID, string LineID, PubParasInfo pubParasInfo)
        {
            try
            {
                XorderDetailBLL xorderDetailBLL = new XorderDetailBLL(pubParasInfo);
                return xorderDetailBLL.GetXorderDetailInfoByID(xOrderID, LineID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public XordersInfo GetXordersInfoByID(string xOrderID, PubParasInfo pubParasInfo)
        {
            try
            {
                XordersBLL xordersBLL = new XordersBLL(pubParasInfo);
                return xordersBLL.GetXordersInfoByID(xOrderID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public DataSet GetXordersInfoByQueryEntity(XordersQueryEntity xordersQueryEntity, PubParasInfo pubParasInfo)
        {
            try
            {
                XordersBLL xordersBLL = new XordersBLL(pubParasInfo);
                return xordersBLL.GetXordersByQueryEntity(xordersQueryEntity);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public DataSet GetXordersReceiptPurchaseOrderByQueryList(XordersQueryEntity xordersQueryEntity, PubParasInfo pubParasInfo)
        {
            try
            {
                XordersBLL xordersBLL = new XordersBLL(pubParasInfo);
                return xordersBLL.GetXordersReceiptPurchaseOrderByQueryList(xordersQueryEntity);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return null;
        }

        public string InsertApportionRuleInfo(ApportionRuleInfo apportionRuleInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                ApportionRuleBLL apportionRuleBll = new ApportionRuleBLL(pubParasInfo);
                return apportionRuleBll.Insert(apportionRuleInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string InsertLane(LaneInfo laneInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                LaneBLL laneBll = new LaneBLL(pubParasInfo);
                return laneBll.Insert(laneInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string InsertOppOrderRuleDetailInfo(OppOrderRuleDetailInfo oppOrderRuleDetailInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                OppOrderRuleDetailBLL OppOrderRuleDetailBll = new OppOrderRuleDetailBLL(pubParasInfo);
                return OppOrderRuleDetailBll.InsertDetail(oppOrderRuleDetailInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string InsertOppOrderRuleInfo(OppOrderRuleInfo oppOrderRuleInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                OppOrderRuleBLL oppOrderRuleBll = new OppOrderRuleBLL(pubParasInfo);
                return oppOrderRuleBll.Insert(oppOrderRuleInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string InsertXordersInfo(XordersInfo xOrdersInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                XordersBLL xordersBLL = new XordersBLL(pubParasInfo);
                return xordersBLL.InsertXorders(xOrdersInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string UpdateApportionRuleInfo(ApportionRuleInfo apportionRuleInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                ApportionRuleBLL apportionRuleBll = new ApportionRuleBLL(pubParasInfo);
                return apportionRuleBll.Update(apportionRuleInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string UpdateLane(LaneInfo laneInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                LaneBLL laneBll = new LaneBLL(pubParasInfo);
                return laneBll.Update(laneInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string UpdateOppOrderRuleDetailInfo(OppOrderRuleDetailInfo oppOrderRuleDetailInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                OppOrderRuleDetailBLL OppOrderRuleDetailBll = new OppOrderRuleDetailBLL(pubParasInfo);
                return OppOrderRuleDetailBll.UpdateDetail(oppOrderRuleDetailInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string UpdateOppOrderRuleInfo(OppOrderRuleInfo oppOrderRuleInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                OppOrderRuleBLL oppOrderRuleBll = new OppOrderRuleBLL(pubParasInfo);
                return oppOrderRuleBll.Update(oppOrderRuleInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string UpdateXordersInfo(XordersInfo xOrdersInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                XordersBLL xordersBLL = new XordersBLL(pubParasInfo);
                return xordersBLL.UpdateXOrdres(xOrdersInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return temp;
        }

        public string UpdateXOrdreDetail(XorderDetailInfo xorderDetailInfo, PubParasInfo pubParasInfo)
        {
            try
            {
                XorderDetailBLL xorderDetailBLL = new XorderDetailBLL(pubParasInfo);
                return xorderDetailBLL.UpdateXOrdreDetail(xorderDetailInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return "";
        }

        public string XorderAllocate(string receiptID, string xorderID, List<string> lineID, PubParasInfo pubParasInfo)
        {
            try
            {
                XorderDetailBLL xorderDetailBLL = new XorderDetailBLL(pubParasInfo);
                return xorderDetailBLL.XorderAllocate(receiptID, xorderID, lineID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return "";
        }

        public string XPickDetailShipping(List<string> XpickDetailID, PubParasInfo pubParasInfo)
        {
            try
            {
                XorderDetailBLL xorderDetailBLL = new XorderDetailBLL(pubParasInfo);
                return xorderDetailBLL.XPickDetailShipping(XpickDetailID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ICrossdockService异常");
            }
            return "";
        }
    }
}

